function ResultHandler(result) {
    if (result && typeof result.length === "number" && result.length > 1) {
        result = result[1].data;
    }
    if (result.isok || result.code == 0) {
        return { success: true, message: result.message, ...result.data };
    } else {
        return { success: false, code: result.code, message: result.message };
    }
}

export { ResultHandler };